package com.engine4cloud.tdf.education.convert;

import com.engine4cloud.tdf.education.dto.create.PublicWelfareAttendCreateDTO;
import com.engine4cloud.tdf.education.dto.result.PublicWelfareAttendResultDTO;
import com.engine4cloud.tdf.education.dto.update.PublicWelfareAttendUpdateDTO;
import com.engine4cloud.tdf.education.entity.PublicWelfareAttendEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;


@Mapper
public interface EduPublicWelfareAttendConvert {
    EduPublicWelfareAttendConvert INSTANCE = Mappers.getMapper(EduPublicWelfareAttendConvert.class);

    PublicWelfareAttendEntity createTo(PublicWelfareAttendCreateDTO s);

    PublicWelfareAttendEntity update(PublicWelfareAttendUpdateDTO s);

    PublicWelfareAttendResultDTO convert(PublicWelfareAttendEntity s);

    default PublicWelfareAttendEntity create(String code, PublicWelfareAttendCreateDTO s, Long tenantId) {
        PublicWelfareAttendEntity entity = createTo(s);
        entity.setHdbh(code);
        entity.setTenantId(tenantId);
        return entity;
    }
}
